<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>17-元素的尺寸</title>
    <style>
        div {
            width: 100px;
            height: 150px;
            background: red;
            padding: 10px;
            border: 10px #fbd850 solid;
            margin: 10px;
        }
    </style>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
    <script>
        $(() => {
            /**
             * 知识点：
             * 1. 内容尺寸
             *      height(): height
             *      width(): width
             * 2. 内部尺寸
             *      innerHeight(): height+padding
             *      innerWidth(): width+padding
             * 3. 外部尺寸
             *      outerHeight(false/true): height+padding+border  如果是true, 加上margin
             *      outerWidth(false/true): width+padding+border 如果是true, 加上margin
            */

            /**
             * 1. 内容尺寸
            */
            const width = $('div').width()
            const height = $('div').height()
            console.log(width, height)

            /**
             * 2. 内部尺寸
            */
            const innerWidth = $('div').innerWidth()
            const innerHeight = $('div').innerHeight()
            console.log(innerWidth, innerHeight)

            /**
             * 3. 外部尺寸
            */
            // const outerWidth = $('div').outerWidth()
            // const outerHeight = $('div').outerHeight()
            const outerWidth = $('div').outerWidth(true)
            const outerHeight = $('div').outerHeight(true)
            console.log(outerWidth, outerHeight)
        })
    </script>
</head>

<body>
    <div>div</div>
</body>

</html>